export const nodeOps = {
  // createElement，不同平台创建不一样

  //#region 元素操作
  createElement: tagName => document.createElement(tagName),

  remove: child => {
    const parent = child.parentNode;

    if (parent) {
      parent.removeChild(child);
    }
  },

  insert: (child, parent, anchor = null) => {
    parent.insertBefore(child, anchor);
  },
  
  querySelector: selector => document.querySelector(selector),
  //#endregion

  //#region 文本操作
  setElementText: (el, text) => el.textContent = text,

  createText: text => document.createTextNode(text),

  setText: (node, text) => node.nodeValue = text,
  //#endregion

  nextSibling: node => node.nextSibling
}